<!-- 框架合同申请 - 确认合同归档 -->
<template>
	<view class="page">
		<u--form
			class="basic-style"
			labelPosition="top"
			:model="basicForm"
			ref="form1"
			labelWidth="auto"
			:labelStyle="{
				fontSize: '14px',
				color: '#B2B2B2',
				lineHight: '20px'
			}"
		>
			
			<u-form-item
				label="单据编号"
				prop="htbh"
				:borderBottom="false"
				ref="item1"
			>
				<u--input
					disabled
					placeholder="请输入单据编号"
					v-model="basicForm.htbh"
					border="surround"
				></u--input>
			</u-form-item>
			<u-form-item
				label="申请时间"
				prop="createTime"
				:borderBottom="false"
				ref="item1"
			>
				<u--input
					v-model="basicForm.createTime"
					disabled
					placeholder="请选择时间"
					border="surround"
					suffixIcon="calendar-fill"
					:suffixIconStyle="{color: '#B2B2B2'}"
				></u--input>
			</u-form-item>
			<u-form-item
				label="申请人"
				prop="proposer_dictText"
				:borderBottom="false"
				ref="item1"
			>
				<u--input
					v-model="basicForm.proposer_dictText"
					disabled
					placeholder="请选择申请人"
					border="surround"
					suffixIcon="arrow-down-fill"
					:suffixIconStyle="{color: '#B2B2B2'}"
				></u--input>
			</u-form-item>
			<u-form-item
				label="申请部门"
				prop="proposerDeptId_dictText"
				:borderBottom="false"
				ref="item1"
			>
				<u--input
					v-model="basicForm.proposerDeptId_dictText"
					disabled
					placeholder="请选择申请部门"
					border="surround"
					suffixIcon="arrow-down-fill"
					:suffixIconStyle="{color: '#B2B2B2'}"
				></u--input>
			</u-form-item>
			
			<view class="basic-title basic-border">基本信息</view>
			<!-- 描述 当lx是1时代表申请合同 等于2的时候代表变更合同申请 -->
			<view v-show = "basicForm.lx == 2">
				<u-form-item
					v-show = "basicForm.lx == 2"
					label="合同编号"
					prop="caId_dictText"
					:borderBottom="false"
					ref="item1"
				>
					<u--input
						disabled
						placeholder="请选择合同编号"
						v-model="basicForm.caId_dictText"
						border="surround"
						suffixIcon="arrow-down-fill"
						:suffixIconStyle="{color: '#B2B2B2'}"
					></u--input>
				</u-form-item>
			</view>
			<u-form-item
				label="合同名称"
				prop="htmc"
				:borderBottom="false"
				ref="item1"
				required
			>
				<u--input
                    disabled
					v-model="basicForm.htmc"
					placeholder="请输入合同名称"
					border="surround"
				></u--input>
			</u-form-item>
			<u-form-item
				v-if="basicForm.htlx ==2"
				label="费用类型"
				prop="feeType"
				:borderBottom="false"
				ref="item1"
				required
			>
				<h-dict-select
					disabled
					style="width: 100%" 
					v-model="basicForm.feeType" 
					placeholder="请选择费用类型" 
					dictName="fee_type" 
					suffixIcon="arrow-down-fill" 
					:suffixIconStyle="{color: '#B2B2B2'}"
				></h-dict-select>
			</u-form-item>
			<!-- <u-form-item
				v-if="basicForm.htlx ==2"
				label="是否采购类"
				prop="isCategoryType"
				:borderBottom="false"
				ref="item1"
				required
			>
				<h-dict-radio v-model="basicForm.isCategoryType" @change="handleChangeCategory" dictName="is_category_type"></h-dict-radio>
			</u-form-item> -->
			<u-form-item
				
				label="合同类型"
				prop="htlx"
				:borderBottom="false"
				ref="item1"
				required
			>
				<h-dict-select
					:disabled="true"
					style="width: 100%" 
					v-model="basicForm.htlx" 
					placeholder="请选择合同类型" 
					dictName="htlx_type" 
					suffixIcon="arrow-down-fill" 
					:suffixIconStyle="{color: '#B2B2B2'}"
					@change="onHtlxDetail"
				></h-dict-select>
			</u-form-item>
			<view v-show = "basicForm.lx == 2">
				<u-form-item
				v-show = "basicForm.lx == 2"
				label="变更类型"
				prop="bglx_dictText"
				:borderBottom="false"
				ref="item1"
				required>
					<u--input
						v-model="basicForm.bglx_dictText"
						disabled
						placeholder="请选择变更类型"
						border="surround"
						suffixIcon="arrow-down-fill"
						:suffixIconStyle="{color: '#B2B2B2'}"
					></u--input>
				</u-form-item>
			</view>
			<!-- <u-form-item
				label="项目名称"
				prop="xmmc_dictText"
				:borderBottom="false"
				ref="item1"
				required
			>
				<u--input
					v-model="basicForm.xmmc_dictText"
					disabled
					placeholder="请选择项目名称"
					border="surround"
					suffixIcon="arrow-down-fill"
					:suffixIconStyle="{color: '#B2B2B2'}"
				></u--input>
			</u-form-item> -->
			<!-- <u-form-item
				v-show = "basicForm.isCategoryType == 1"
				label="采购类型"
				prop="provisionType"
				:borderBottom="false"
				ref="item1"
				required
			>
	
				<h-dict-select
					style="width: 100%" 
					v-model="basicForm.provisionType" 
					placeholder="请选择采购类型" 
					dictName="provision_type" 
					suffixIcon="arrow-down-fill" 
					:suffixIconStyle="{color: '#B2B2B2'}"
					@change="handleChangeProvisionType"
				></h-dict-select>
			</u-form-item> -->
			<u-form-item
				style="display:none"
				label="项目编号"
				prop="xmbh"
				:borderBottom="false"
				ref="item1"
			>
				<u--input
					v-model="basicForm.xmbh"
					disabled
					placeholder="请输入项目编号"
					border="surround"
					suffixIcon="arrow-down-fill"
					:suffixIconStyle="{color: '#B2B2B2'}"
				></u--input>
			</u-form-item>
			<!-- <u-form-item
				v-if="basicForm.htlx == 2 && basicForm.feeType=='2'"
				label="费用所属团队"
				prop="jytd_dictText"
				:borderBottom="false"
				ref="item1"
				required
			>
				<h-select-team-input-popup
				 @change="changeBusinessCompany"
				  style="width: 100%"
				  v-model="basicForm.jytd"
				  placeholder="请选择费用所属团队"
				  :tdlx="1"
				  border="surround"
					suffixIcon="arrow-down-fill"
					:suffixIconStyle="{ color: '#B2B2B2' }"
				></h-select-team-input-popup>
			</u-form-item> -->
			<u-form-item
				label="经营团队"
				prop="jytd"
				:borderBottom="false"
				ref="item1"
				required
			>
				<h-select-team-input-popup
				 @change="changeBusinessCompany"
				  style="width: 100%"
                  disabled
				  v-model="basicForm.jytd"
				  placeholder="请选择经营团队"
				  :tdlx="1"
				  border="surround"
					suffixIcon="arrow-down-fill"
					:suffixIconStyle="{ color: '#B2B2B2' }"
				></h-select-team-input-popup>
			</u-form-item>
			<u-form-item
				label="业绩归属年度"
				prop="yjgsnd"
				:borderBottom="false"
				ref="item1"
				required
			>
				<h-dict-select 
					style="width: 100%" 
					v-model="basicForm.yjgsnd" 
					placeholder="请选择业绩归属年度" 
					dictName="yjgsnd" 
                    disabled
					suffixIcon="arrow-down-fill" 
					:suffixIconStyle="{color: '#B2B2B2'}"
				></h-dict-select>
			</u-form-item>
			
			<u-form-item
				label="签订单位"
				prop="qddw_dictText"
				:borderBottom="false"
				ref="item1"
				required
			>
				<u--input
					v-model="basicForm.qddw_dictText"
					disabled
					placeholder="请选择签订单位"
					border="surround"
					suffixIcon="arrow-down-fill"
					:suffixIconStyle="{color: '#B2B2B2'}"
				></u--input>
			</u-form-item>
			<u-form-item
				label="项目承接人"
				prop="xmcjr_dictText"
				:borderBottom="false"
				ref="item1"
				required
			>
				<u--input
					v-model="basicForm.xmcjr_dictText"
					disabled
					placeholder="请选择项目承接人"
					border="surround"
					suffixIcon="arrow-down-fill"
					:suffixIconStyle="{color: '#B2B2B2'}"
				></u--input>
			</u-form-item>
			<u-form-item
				label="业主单位"
				prop="yzdw"
				:borderBottom="false"
				ref="item1"
				required
			>
				<h-select-customer-input
					style="width: 100%"
					v-model="basicForm.yzdw"
					:commercialType= "basicForm.htlx"
					border="surround"
                    disabled
					placeholder="请选择业主单位"
					suffixIcon="arrow-down-fill"
					:suffixIconStyle="{color: '#B2B2B2'}"
					objectField = 'basicForm.yzdw'
					@change="onCustomerChange"
				></h-select-customer-input>
			</u-form-item>
			<u-form-item
				label="联系人"
				prop="lxr"
				:borderBottom="false"
				ref="item1"
			>
				<h-dict-select
					style="width: 100%" 
					v-model="basicForm.lxr" 
                    disabled
					placeholder="请选择联系人" 
					:dictName="cust_lxr" 
					suffixIcon="arrow-down-fill" 
					:suffixIconStyle="{color: '#B2B2B2'}"
					@change="lxrChange"
				></h-dict-select>
			</u-form-item>
			<u-form-item
				label="联系方式"
				prop="lxfs"
				:borderBottom="false"
				ref="item1"
			>
				<u--input
					v-model="basicForm.lxfs"
                    disabled
					placeholder="请填写联系方式"
					border="surround"
				></u--input>
			</u-form-item>
			<u-form-item
				label="签订日期"
				prop="qdrq"
				:borderBottom="false"
				ref="item1"
				required
			>
				<h-time-select
					v-model="basicForm.qdrq"
					placeholder="请选择签订日期"
					border="surround"
					suffixIcon="calendar-fill"
					:suffixIconStyle="{color: '#B2B2B2'}"
				></h-time-select>
			</u-form-item>

			<u-form-item
				label="是否用印"
				prop="sfyz"
				:borderBottom="false"
                disabled
				ref="item1"
			>
				<h-dict-radio v-model="basicForm.sfyz" disabled dictName="yn" @input="handleChangeSeal"></h-dict-radio>
			</u-form-item>
			<!-- <u-form-item v-if="basicForm.sfyz == '0'" label="无正式合同" prop="noFormalContract" required>
				<h-dict-radio disabled v-model="basicForm.noFormalContract" dictName="YES_OR_NO"></h-dict-radio>
			</u-form-item> -->
			<view v-show="basicForm.sfyz && basicForm.sfyz ==1">
				<u-form-item label="用印类型" prop="signSealWay" required>
				  <h-select-input-tag
				    class="w-100"
					disabled
				    v-model="basicForm.signSealWay"
				    objectField="basicForm.signSealWay"
				    placeholder="请选择用印类型"
						suffixIcon="arrow-down-fill"
						:suffixIconStyle="{ color: '#B2B2B2' }"
				    border="surround"
				    dictName="seal_way"
						@change="handleSignSealWay"
				  ></h-select-input-tag>
				</u-form-item>
				<u-form-item
					v-show="basicForm.sfyz && basicForm.sfyz ==1"
					label="印章类型"
					prop="yzlx"
					:borderBottom="false"
					ref="item1"
					required
				>
					<h-dict-multi-select 
						v-model="basicForm.yzlx"
						style="width: 100%" 
						disabled
						placeholder="请选择印章类型"
						dictName="yzlx_type"
						border="surround"
						suffixIcon="arrow-down-fill"
						:suffixIconStyle="{color: '#B2B2B2'}"
					></h-dict-multi-select>
				</u-form-item>
				<u-form-item
					v-show="basicForm.sfyz && basicForm.sfyz ==1"
					label="用印份数"
					prop="yyfs"
					:borderBottom="false"
					ref="item1"
					required
				>
					<h-number-input placeholder="请填写用印份数" disabled v-model="basicForm.yyfs" :digit="0" :min="1" :suffixIconStyle="{color: '#B2B2B2'}"></h-number-input>
				</u-form-item>
			</view>
			
			<u-form-item
				label="是否存档"
				prop="sfcd"
				:borderBottom="false"
				ref="item1"
				required
			>
				<h-dict-radio v-model="basicForm.sfcd" dictName="yes_no"></h-dict-radio>
			</u-form-item>
			<u-form-item
				v-show="basicForm.sfcd ==1"
				label="合同存档份数"
				prop="cdfs"
				:borderBottom="false"
				ref="item1"
				required
			>
				<h-number-input placeholder="请填写合同存档份数" v-model="basicForm.cdfs" :digit="0" :min="0"></h-number-input>
			</u-form-item>
			<!-- <u-form-item
				
				label="合同原件"
				prop="masterCopy"
				:borderBottom="false"
				ref="item1"
			>
				<view class="" style="width: 100%;">
					<h-upload-file v-model="basicForm.masterCopy" :isIcon="false"></h-upload-file>
					<file-list v-if="basicForm.masterCopy" v-model="basicForm.masterCopy" :isDelete="true"></file-list>
				</view>
				
			</u-form-item> -->
			
			<view v-show="basicForm.sfyz ==0">
				<u-form-item
					label="合同原件"
					prop="masterCopy"
					:borderBottom="false"
					ref="item1"
				>
					<view class="">
						<!-- <h-upload-file v-model="basicForm.masterCopy" :isIcon="false"></h-upload-file> -->
						<file-list :fileList="basicForm.masterCopy"></file-list>
					</view>
				</u-form-item>
			</view>
			
			<!-- <view v-show="basicForm.htlx !='1'">
				<u-form-item
					v-show="basicForm.htlx !='1'"
					label="关联收款合同"
					prop="glskht"
					:borderBottom="false"
					ref="item1"
				>
					  <h-dict-radio v-model="basicForm.glskht" @change="glskhtChange" dictName="yn" :disabled="basicForm.htlx == '1'"></h-dict-radio>
				</u-form-item>
			</view> -->	
			<u-form-item
				label="本次合同额(元)"
				prop="bchte"
				:borderBottom="false"
				ref="item1"
				required
			>
				<u--input
					type="number"
                    disabled
					v-model="basicForm.bchte"
					placeholder="请填写合同额"
					border="surround"
					@change="convertMoney2"
					@blur="convertMoneyBlur2"
					:suffixIconStyle="{color: '#B2B2B2'}"
				></u--input>
			</u-form-item>
			<u-form-item
				label="本次合同额大写"
				prop="bchtedx"
				:borderBottom="false"
				ref="item1"
			>
				<u--input
					v-model="basicForm.bchtedx"
					disabled
					placeholder="请填写合同额大写"
					border="surround"
					:suffixIconStyle="{color: '#B2B2B2'}"
				></u--input>
			</u-form-item>
			<!-- <u-form-item
				label="经营绩效(元)"
				prop="businessPerformance"
				:borderBottom="false"
				ref="item1"
				required>
				<h-money-input
					type="number"
					disabled
					placeholder="请输入经营绩效"
					v-model="basicForm.businessPerformance"
				></h-money-input>
			</u-form-item> -->
			<u-form-item
				label="服务期限"
				prop="fwqx"
				:borderBottom="false"
				ref="item1"
				required
			>
				<u--input 
					v-model="serviceHours"
                    disabled
					placeholder="请选择服务期限"
					border="surround"
					></u--input>
			</u-form-item>
		</u--form>
		
		<view class="basic-style">
			<!-- ManagerEntrustType -->
			<view class="basic-title basic-border">{{basicForm.htlx == 2?'受托方(合同乙方)信息':'委托方(合同甲方)信息'}}</view>
			<view class="inforamtion" style="display: flex;" v-for="(item, index) in getManagerEntrustList" :key="index">
				<view >
					<view class="option" style="width: 520rpx;">
						<view class="lf">名称</view>
						<view class="rl">{{ item.khdaId_dictText }}</view>
					</view>
					<view class="option" style="width: 520rpx;">
						<!-- <view class="lf">{{basicForm.htlx == 3?'是否为收款单位':'是否为付款单位'}}</view> -->
						<!-- <view class="rl">{{ basicForm.htlx == 3?item.isSk_dictText:item.isFk_dictText }}</view> -->
					</view>
					<template v-if="basicForm.signSealWay == 'online'">
						<view class="option" style="width: 520rpx;">
							<view class="lf">对方是否电子签章</view>
							<view class="rl"> {{ filterMultiDictText(dictOptions['isSignSeal'], item.isSignSeal + '') }}</view>
						</view>
						<view class="option" style="width: 520rpx;" v-if="item.isSignSeal && item.isSignSeal == 1">
							<view class="lf">对方盖章人</view>
							<view class="rl"> {{ item.psnName }}</view>
						</view>
						<view class="option" style="width: 520rpx;" v-if="item.isSignSeal && item.isSignSeal == 1">
							<view class="lf">联系方式</view>
							<view class="rl"> {{ item.psnMobile }}</view>
						</view>
					</template>
				</view>
				<view style="flex: 1; display: flex; align-items: center; justify-content: flex-end;">
					<u-icon v-if="false" name="edit-pen-fill" color="#2979ff" size="20" @click="onManagerEntrustEdit(item, index)"></u-icon>
					<u-line  direction="col" length="20" margin="0 10rpx"></u-line>
					<u-icon v-if="false" name="trash-fill" color="#2979ff" size="20"  @click="onManagerEntrustDelete(item, index)"></u-icon>
				</view>
			</view>
			<view  style="margin: 20rpx 20rpx 0rpx 20rpx;">
				<u-button text="新增" disabled type="primary" @click="onManagerEntrustAdd"></u-button>
			</view>
		</view>
		
		<view class="basic-style">
			<view class="basic-title basic-border">{{basicForm.htlx == 3?'受托方(合同乙方)信息':'委托方(合同甲方)信息'}}</view>
			<view class="inforamtion" style="display: flex;" v-for="(item, index) in getManagerTrusteeList" :key="index">
				<view >
					<view class="option" style="width: 520rpx;">
						<view class="lf">名称</view>
						<view class="rl">{{ item.gsdaId_dictText }}</view>
					</view>
					<view class="option" style="width: 520rpx;">
						<!-- <view class="lf">{{basicForm.htlx == 1?'是否为收款单位':'是否为付款单位'}}</view> -->
						<!-- <view class="rl">{{ item.gsdaId_dictText }}</view> -->
						<!-- <view class="rl">{{ basicForm.htlx == 1?item.isSk_dictText:item.isFk_dictText }}</view> -->
					</view>
					<template v-if="basicForm.signSealWay == 'online'">
						<view class="option" style="width: 520rpx;">
							<view class="lf">我方经办人</view>
							<view class="rl"> {{ item.psnName }}</view>
						</view>
						<view class="option" style="width: 520rpx;">
							<view class="lf">联系方式</view>
							<view class="rl"> {{ item.psnMobile }}</view>
						</view>
					</template>
				</view>
				<view style="flex: 1; display: flex; align-items: center; justify-content: flex-end;">
					<u-icon v-if="false" name="edit-pen-fill" color="#2979ff" size="20" @click="onManagerTrusteeEdit(item, index)"></u-icon>
					<u-line  direction="col" length="20" margin="0 10rpx"></u-line>
					<u-icon v-if="false" name="trash-fill" color="#2979ff" size="20"  @click="onManagerTrusteeDelete(item, index)"></u-icon>
				</view>
			</view>
			<view  style="margin: 20rpx 20rpx 0rpx 20rpx;">
				<u-button text="新增" disabled type="primary" @click="onManagerTrusteeAdd"></u-button>
			</view>
		</view>
		
		<!-- 付款合同隐藏任务信息 -->
		<view class="basic-style" v-if="basicForm.htlx == 1">
			<view class="basic-title basic-border">任务信息</view>
			<view class="inforamtion" v-for="(item, index) in getManagerClassList" :key="index">
				<view class="option">
					<view class="lf">业务编码</view>
					<view class="rl">{{ item.ywfl }}</view>
				</view>
				<view class="option">
					<view class="lf">业务名称</view>
					<view class="rl">{{ item.ywmc }}</view>
				</view>
				<view class="option"  style="align-items: center;">
					<view class="lf">合同占比(%)<u-icon style="display: inline-block;" name="edit-pen-fill" size="16"></u-icon></view>
					<view class="rl" style="width: 100%">
						<u--input
							v-model="item.htzb"
							placeholder="请输入合同占比"
							border="none"
							clearable
							style="width: 100%"
							type="number" 
							:disabled="(item.distributionType == 'cancel' && item.shouldPayFlag == '1') ? true : basicForm.distributionMethod == 2"
							@change="onChangehtzb(index, item.thzb)"
						></u--input>
					</view>
				</view>
				<view class="option" style="align-items: center;">
					<view class="lf">分配合同额(元) <u-icon style="display: inline-block;" name="edit-pen-fill" size="16"></u-icon></view>
					<view class="rl" style="width: 100%">
						<u--input
							v-model="item.fphte"
							placeholder="请输入分配合同额"
							border="none"
							clearable
							type="number"
							:disabled="(item.distributionType == 'cancel' && item.shouldPayFlag == '1') ? true : basicForm.distributionMethod == 1"
							@change="onChangefphte(index,item.fphte)"
						></u--input>
					</view>
				</view>
				<view class="option" style="align-items: center;">
					<view class="lf">切割合同额(元) <u-icon style="display: inline-block;" name="edit-pen-fill" size="16"></u-icon></view>
					<view class="rl" style="width: 100%">
						<u--input
							v-model="item.cutContractAmount"
							placeholder="请输入切割合同额"
							border="none"
							clearable
							type="number"
						></u--input>
					</view>
				</view>
				<view class="option">
					<view class="lf">生产团队</view>
					<view class="rl">{{ item.sctd_dictText }}</view>
				</view>
				<!-- <view class="option">
					<view class="lf">生产公司</view>
					<view class="rl">{{ item.productCompanyId ? filterMultiDictText(dictOptions['gsda'], item.productCompanyId + '') : '' }}</view>
				</view> -->
				<view class="option">
					<view class="lf">团队负责人</view>
					<view class="rl">{{ item.tdfzr_dictText }}</view>
				</view>
				
			</view>
		</view>
		
		<u--form
			class="basic-style"
			labelPosition="top"
			:model="basicForm"
			ref="form1"
			labelWidth="auto"
			:labelStyle="{
				fontSize: '14px',
				color: '#B2B2B2',
				lineHight: '20px'
			}"
		>
			<view class="basic-title basic-border">其他信息</view>
			<u-form-item
				label="备注"
				prop="bz"
				:borderBottom="false"
				ref="item1"
			>
				<u--textarea disabled confirmType="done" v-model="basicForm.bz" placeholder="请输入备注" ></u--textarea>
			</u-form-item>
			<u-form-item
				label="邮寄信息"
				prop="yjxx"
				:borderBottom="false"
				ref="item1"
			>
				<u--textarea confirmType="done" disabled v-model="basicForm.yjxx" placeholder="请输入邮寄信息" ></u--textarea>
			</u-form-item>
			<u-form-item
			   v-show = "basicForm.lx == 2"
				label="变更说明"
				prop="contractChangeReason"
				:borderBottom="false"
				ref="item1"
			>
				<u--textarea confirmType="done" disabled v-model="basicForm.contractChangeReason" placeholder="请输入变更说明" ></u--textarea>
			</u-form-item>
		</u--form>
		
		<view class="basic-style" v-if="basicForm.sfyz == 1">
		  <view class="basic-title basic-border">用印文件<span style="color: #faad14;font-weight: 600">（请上传只需盖章的用印文件！）</span></view>
				<view class="py-1 space-y-1" style="width: 100%">
					<file-list v-if="basicForm.signFile" v-model="basicForm.signFile"></file-list>
				</view>
		</view>
		
		<!-- 附件 -->
		<view class="basic-style">
			<view class="basic-title basic-border">相关附件</view>
			<!-- <file-list :fileList="basicForm.attachment" style="padding-top:16rpx"></file-list> -->
			<view class="" style="width: 100%;">
				<!-- <h-upload-file v-model="basicForm.xgfj" :isIcon="false" ></h-upload-file> -->
				<file-list v-if="basicForm.xgfj" v-model="basicForm.xgfj" :isDelete="false"></file-list>
			</view>
		</view>
		
		<view class="space-x-1 px-1 btn_position">
			<backButton  @onSubmit="onSubmit" :nodeObj="nodeObj" :model="model" :resultObj="resultObj"></backButton>
		</view>
		<view style="height: 100rpx;"></view>
		
		<u-popup :show="showPopup" @close="closePopup" :round="10">
			<view style="background-color: #ffffff; border-radius: 10px; padding: 20rpx;">
				<u--form
					
					labelPosition="top"
					:model="plainForm"
					ref="form1"
					labelWidth="auto"
					:labelStyle="{
						fontSize: '14px',
						color: '#B2B2B2',
						lineHight: '20px'
					}"
				>
					<u-form-item
						label="款项名称"
						prop="kxmc"
						:borderBottom="false"
						ref="item1"
						required
					>
						<u--input
							v-model="plainForm.kxmc"
							placeholder="请填写款项名称"
							border="surround"
							:suffixIconStyle="{color: '#B2B2B2'}"
						></u--input>
					</u-form-item>
					
					<u-form-item
						label="金额(元)"
						prop="je"
						:borderBottom="false"
						ref="item1"
						required
					>
						<u--input
							type="number"
							v-model="plainForm.je"
							placeholder="请填写金额"
							border="surround"
							@blur="onPlainFormMoneyBlur"
							:suffixIconStyle="{color: '#B2B2B2'}"
						></u--input>
					</u-form-item>
					<span v-if="plainForm.collectMoney" style="color: red">
						<span v-if="basicForm.htlx == '1'"> 当前款项已收{{plainForm.collectMoney}}元 , 金额调整不可低于实收金额</span>
						<span v-if="basicForm.htlx == '2'"> 当前款项已付{{plainForm.collectMoney}}元 , 金额调整不可低于实付金额</span>
					</span>
					<u-form-item
						label="款项日期"
						prop="kxrq"
						:borderBottom="false"
						ref="item1"
						required
					>
						<h-time-select
							v-model="plainForm.kxrq"
							placeholder="请选择款项日期"
							border="surround"
							suffixIcon="calendar-fill"
							:suffixIconStyle="{color: '#B2B2B2'}"
						></h-time-select>
					</u-form-item>
					<u-form-item
						label="款项节点说明"
						prop="kxjdsm"
						:borderBottom="false"
						ref="item1"
						required
					>
						<u--input
							v-model="plainForm.kxjdsm"
							placeholder="请填写款项节点说明"
							border="surround"
							:suffixIconStyle="{color: '#B2B2B2'}"
						></u--input>
					</u-form-item>
				</u--form>
				<view style="padding-bottom:20rpx;">
					<u-button text="确定" type="primary" @click="onConfirmPopup"></u-button>
				</view>
			</view>
		</u-popup>
		
		<!-- 受托方弹窗 -->
		<u-popup :show="showCommissionedPopup" @close="closeCommissionedPopup" :round="10">
			<view style="background-color: #ffffff; border-radius: 10px; padding: 20rpx;">
				<u--form
					
					labelPosition="top"
					:model="commissionedForm"
					ref="form1"
					labelWidth="auto"
					:labelStyle="{
						fontSize: '14px',
						color: '#B2B2B2',
						lineHight: '20px'
					}"
				>
					<u-form-item
						label="名称"
						prop="khdaId"
						:borderBottom="false"
						ref="item1"
						required
					>
						
						<h-select-customer-input-popup
						  style="width: 100%"
						  commercialType="2"
							:isJudge='true'
							@onJudge='onJudge'
						  v-model="commissionedForm.khdaId"
						  border="surround"
						  placeholder="请选择关联往来单位"
						  suffixIcon="arrow-down-fill"
						  :suffixIconStyle="{ color: '#B2B2B2' }"/>
						<u-icon style="margin-left: 10upx;" name="plus" color="#2979ff" size="24" @click="getUnSupplier"/>
						
					</u-form-item>
					<u-form-item
						:label="basicForm.htlx == 2?'是否为收款单位':'是否为付款单位'"
						:prop="ManagerEntrustType"
						:borderBottom="false"
						ref="item1"
						required
					>
						<h-dict-radio v-model="commissionedForm[ManagerEntrustType]" dictName="yes_no"></h-dict-radio>
					</u-form-item>
					
					<template v-if="basicForm.signSealWay == 'online'">
						<u-form-item label="对方是否电子签章" prop="isSignSeal" required>
							<h-dict-radio v-model="commissionedForm.isSignSeal" dictName="yes_no" @input="isSignSealInput"></h-dict-radio>
						</u-form-item>
						<u-form-item label="对方盖章人" prop="psnName" required v-if="commissionedForm.isSignSeal && commissionedForm.isSignSeal == 1">
							<u--input v-model="commissionedForm.psnName" placeholder="请输入对方盖章人"></u--input>
						</u-form-item>
						<u-form-item label="联系方式" prop="psnMobile" required v-if="commissionedForm.isSignSeal && commissionedForm.isSignSeal == 1">
							<u--input v-model="commissionedForm.psnMobile" placeholder="请输入联系方式"></u--input>
						</u-form-item>
					</template>
					<!-- <template v-else-if="basicForm.htlx != 1 && basicForm.signSealWay == 'online'">
						<u-form-item label="我方经办人" prop="psnName" required>
							<u--input v-model="commissionedForm.psnName" placeholder="请输入我方盖章人"></u--input>
						</u-form-item>
						<u-form-item label="联系方式" prop="psnMobile" required>
							<u--input v-model="commissionedForm.psnMobile" placeholder="请输入联系方式"></u--input>
						</u-form-item>
					</template> -->
					
				</u--form>
				<view style="padding-bottom:20rpx;">
					<u-button text="确定" type="primary" @click="onConfirmCommissionedPopup"></u-button>
				</view>
			</view>
		</u-popup>
		
		<!-- 委托方弹窗 -->
		<u-popup :show="showManagerTrusteePopup" @close="closeManagerTrusteePopup" :round="10">
			<view style="background-color: #ffffff; border-radius: 10px; padding: 20rpx;">
				<u--form
					labelPosition="top"
					:model="managerTrusteeForm"
					ref="form1"
					labelWidth="auto"
					:labelStyle="{
						fontSize: '14px',
						color: '#B2B2B2',
						lineHight: '20px'
					}"
				>
					<u-form-item
						label="名称"
						prop="khdaId"
						:borderBottom="false"
						ref="item1"
						required
					>
						<h-select-company-input
							style="width: 100%"
							v-model="managerTrusteeForm.gsdaId"
							border="surround"
							placeholder="请选择公司"
							suffixIcon="arrow-down-fill"
							:suffixIconStyle="{color: '#B2B2B2'}"
							objectField = 'managerTrusteeForm.gsdaId'
						></h-select-company-input>
					</u-form-item>
					<u-form-item
						:label="basicForm.htlx == 2?'是否为付款单位':'是否为收款单位'"
						:prop="ManagerTrusteeType"
						:borderBottom="false"
						ref="item1"
						required
					>
						<h-dict-radio v-model="managerTrusteeForm[ManagerTrusteeType]" dictName="yes_no"></h-dict-radio>
					</u-form-item>
					
					<!-- <template v-if="basicForm.htlx == 2 && basicForm.signSealWay == 'online'">
						<u-form-item label="对方是否电子签章" prop="isSignSeal" required>
							<h-dict-radio v-model="managerTrusteeForm.isSignSeal" dictName="yes_no" @input="isSignSealInput"></h-dict-radio>
						</u-form-item>
						<u-form-item label="对方盖章人" prop="psnName" required v-if="managerTrusteeForm.isSignSeal && managerTrusteeForm.isSignSeal == 1">
							<u--input v-model="managerTrusteeForm.psnName" placeholder="请输入对方盖章人"></u--input>
						</u-form-item>
						<u-form-item label="联系方式" prop="psnMobile" required v-if="managerTrusteeForm.isSignSeal && managerTrusteeForm.isSignSeal == 1">
							<u--input v-model="managerTrusteeForm.psnMobile" placeholder="请输入联系方式"></u--input>
						</u-form-item>
					</template> -->
					<template v-if="basicForm.signSealWay == 'online'">
						<u-form-item label="我方经办人" prop="psnName" required>
							<u--input v-model="managerTrusteeForm.psnName" placeholder="请输入我方盖章人"></u--input>
						</u-form-item>
						<u-form-item label="联系方式" prop="psnMobile" required>
							<u--input v-model="managerTrusteeForm.psnMobile" placeholder="请输入联系方式"></u--input>
						</u-form-item>
					</template>
				</u--form>
				<view style="padding-bottom:20rpx;">
					<u-button text="确定" type="primary" @click="onConfirmManagerTrusteePopup"></u-button>
				</view>
			</view>
		</u-popup>
		
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
import fileList from './components/fileList.vue'
import Decimal from "decimal.js"
import backButton from '@/components/backButton.vue'
import { filterMultiDictText, initDictOptions } from '@/utils/JDictSelectUtil.js'
import {
		queryByIdContractManager, // 根据id查询信息
		erpOmcCustomerManagerContactId, // 获取联系方式
		erpOmcContractManagerClassListAll, // 获取任务信息
		erpOmcContractManagerPlanListAll, // 获取收付款计划
		erpOmcContractManagerEntrustListAll, // 受托方
		erpOmcContractManagerTrusteeListAll, // 委托方
		erpPurchaseSupplierId ,// 往来单位详情信息
		erpCompanyFilesId, // 委托方公司详情
		getProcessTaskTransInfo, // 流程流转
		erpOmcContractManagerEdit // 编辑
	} from '@/api/index.js'
	import {
		BASE_URL
	} from '@/utils/baseUrl.js'
	import { convertCurrency } from '@/utils/MoneyConvert' // 金额大写转换
	import FormC from '@/pages/contract/components/FormC.vue'
	import FormCInfo from '@/pages/contract/components/FormCInfo.vue'
	// pages\contract\components\FormC.vue
export default {
	components: {
		fileList,
		backButton,
		FormC,
		FormCInfo
	},
	data() {
		return {
			filterMultiDictText,
			initDictOptions,
			dictOptions: {},
			index: null,
			basicFormC: {},
			showFormModalC: false,
			resultObj: {}, // 流程图流转信息
			ManagerEntrustType: '',
			ManagerTrusteeType: '',
			isSubmit: false,
			nodeObj: {},
			tabvalue: '',
			cust_lxr: 'erp_omc_customer_manager_contact,lxr,id', // 联系人数据表字典
			// 基本案列数据
			radiolist1: [{
					name: '是',
					disabled: false
				},
				{
					name: '否',
					disabled: false
				}
			],
			// u-radio-group的v-model绑定的值如果设置为某个radio的name，就会被默认选中
			radiovalue1: '是',
			
			id: '', // 详情id值
			basicForm: {
				employeeId_dictText: '', // 员工姓名
				employeeNo: '', // 人员编号
				gender_dictText: '', // 性别
				positionId_dictText: '', // 岗位
				partTime: '', // 入职时间
				endTime: '', // 试用期满时间
			},
			
			plainForm: {
				kxmc: '',
				je: '',
				kxrq: '',
				kxjdsm: '',
				collectMoney: ''
			}, // 收付款计划表单
			getManagerClassList: [], // 任务信息列表
			getManagerPlanList: [], // 收付款信息列表
			getManagerEntrustList: [], // 获取受托方信息
			getManagerTrusteeList: [], // 获取委托方信息
			showPopup: false ,// 弹窗
			clickPopup: '', // 点击编辑还是新增
			managerPlanIndex: 0, // 点击编辑的xindex值
			
			showCommissionedPopup: false, // 受托方弹窗
			clickManagerEntrustPopup: '', // 点击编辑还是新增
			commissionedIndex: 0, // 点击编辑的index值
			commissionedForm: {
				khdaId: '',
				isSignSeal: '0'
			}, // 受托方对象
			
			
			showManagerTrusteePopup: false, // 受托方弹窗
			clickManagerTrusteePopup: '', // 点击编辑还是新增
			managerTrusteeForm: {
				gsdaId: '',
			}, // 委托方对象
			managerTrusteeIndex: 0, // 点击编辑的index值
			
		};
	},
	computed:{
		serviceHours: {
			get() {
				const timeFormat = uni.$u.timeFormat
				var startDate = ''
				var endDate = ''
				if (this.basicForm.fwqx) {
					startDate = timeFormat(this.basicForm.fwqx, 'yyyy-mm-dd')
				}
				if (this.basicForm.fwqxEnd) {
					endDate = timeFormat(this.basicForm.fwqxEnd, 'yyyy-mm-dd')
				}
				
				return startDate && endDate ? startDate + '~' + endDate : ''
			},
			set (val) {
				
			}
		},
		
	},
	 onLoad(options) {
		this.initDictConfig()
		this.model = JSON.parse(decodeURIComponent(options.item))
		var that = this
		// #ifdef APP-NVUE
			var eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
		// #endif
		// #ifndef APP-NVUE
			var eventChannel = this.getOpenerEventChannel();
		// #endif
		// 监听sendMessage事件，获取上一页面通过eventChannel传送到当前页面的数据
		eventChannel.on('sendMessage', function(data) {
			that.tabvalue = data.tabvalue
			
			that.nodeObj = JSON.parse(decodeURIComponent(data.nodeObj))
			that.id = that.nodeObj.dataId
			that.loadData(that.nodeObj.dataId)
			
			that.getErpOmcContractManagerClassList() // 获取任务信息
			that.getErpOmcContractManagerPlanList() // 获取首付款信息
			that.getErpOmcContractManagerEntrustList() // 获取受托方信息
			that.getErpOmcContractManagerTrusteeList() // 获取委托方信息
			that.getProcessTaskTrans(that.model.id)
			
		})




	},
	onReady(){
									// 修改当前页面的标题

		console.log('装修了吗',this.basicForm.lx);
		
	},
	methods: {
    
		changeBusinessCompany(val){
			this.$set(this.basicForm, 'businessCompanyId', val.belongCompanyId);
			// this.model.businessCompanyId = val.belongCompanyId
		},


		initDictConfig() {
			initDictOptions('yes_no').then((res) => {
				if (res.success) {
					this.$set(this.dictOptions, 'isSignSeal', res.result)
				}
			})

			initDictOptions('erp_company_files,file_name,id').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'gsda', res.result)
        }
      })
		},
		// 点击对方是否为电子签章
		isSignSealInput () {
			if (this.basicForm.htlx == 1) {
				this.$set(this.commissionedForm, 'psnName', '')
				this.$set(this.commissionedForm, 'psnMobile', '')
			} else {
				this.$set(this.managerTrusteeForm, 'psnName', '')
				this.$set(this.managerTrusteeForm, 'psnMobile', '')
			}
			
		},
		glskhtChange(val){
			if (val == '0') {
				this.$set(this.basicForm, 'skhtmc', '');
				this.$set(this.basicForm, 'skhte', '');
				this.$set(this.basicForm, 'skhtedx', '');
			}
		},
		// 跳转到完善非正式供应商信息
		getUnSupplier(){
			
			uni.navigateTo({
				url:'/pages/purchase/components/unSupplierForm'
			})
			
		},
		onJudge(){
			// 保存返回的监听，事先处理好
			uni.$on("supplierBack", res => {
				
				this.commissionedForm.khdaId = res.id
				
				// 清除监听
				uni.$off('supplierBack');
			})
			
			uni.navigateTo({
				url:'/pages/common/selectSupplier/selectSupplierInput'
			})
		},
		loadData(id){
			queryByIdContractManager({ id }).then(res => {
				if(res.success){
					if (!res.result.xgfj) {
						res.result.xgfj = ''
					}
					if (!res.result.masterCopy) {
						res.result.masterCopy = ''
					}
					this.basicForm = res.result
					let title = '框架合同申请确认合同归档'
					if (this.basicForm.lx == 2) {
						title = '框架合同变更确认合同归档'
					} else {
						title = '框架合同申请确认合同归档'
					}
					uni.setNavigationBarTitle({
						title: title
					});
					if (this.basicForm.htlx == 1) {
						// 收款合同
						this.ManagerEntrustType = 'isFk' // 第一个值
						this.ManagerTrusteeType = 'isSk'
					} else {
						// 付款合同
						this.ManagerEntrustType = 'isSk' // 第一个值
						this.ManagerTrusteeType = 'isFk'
					}
					this.cust_lxr = 'erp_omc_customer_manager_contact,lxr,id,del_flag=0 and main_id=\'' + res.result.yzdw + '\'';
				} else {
					this.$refs.uToast.show({
						message: res.message,
						type: 'error'
					})
				}
			})
		},
		
		// 获取任务信息
		getErpOmcContractManagerClassList () {
			erpOmcContractManagerClassListAll ({mainId: this.id}).then(res => {
				if (res.success) {
					this.getManagerClassList = res.result || []
				} else {
					this.getManagerClassList = []
				}
			})
		},
		// 获取收付款信息
		getErpOmcContractManagerPlanList () {
			erpOmcContractManagerPlanListAll ({mainId: this.id}).then(res => {
				if (res.success) {
					if (res.result && res.result.length) {
						res.result.map((value, index) => {
							value.infoDisabled = true
							res.result[index].taskId_dictText = '' // 首先款项关联任务字段默认为空
							// 遍历planTaskList数组赋值给taskId_dictText
							res.result[index].taskId_dictText = value.planTaskList && value.planTaskList.length ? (value.planTaskList.map((obj)=>{return obj.categoryName }).join(",")):'';
							return value
						})
					}
					this.getManagerPlanList = res.result || []
				} else {
					this.getManagerPlanList = []
					/* this.$refs.uToast.show({
						message: res.message,
						type: 'error'
					}) */
				}
			})
		},
		
		// 获取受托方信息
		getErpOmcContractManagerEntrustList () {
			erpOmcContractManagerEntrustListAll ({mainId: this.id}).then(res => {
				if (res.success) {
					if (res.result && res.result.length) {
						res.result.map(value => {
							value.infoDisabled = true
							return value
						})
					}
					this.getManagerEntrustList = res.result || []
				} else {
					this.getManagerEntrustList = []
					// this.$refs.uToast.show({
					// 	message: res.message,
					// 	type: 'error'
					// })
				}
			})
		},
		
		// 获取委托方信息
		getErpOmcContractManagerTrusteeList () {
			erpOmcContractManagerTrusteeListAll ({mainId: this.id}).then(res => {
				if (res.success) {
					if (res.result && res.result.length) {
						res.result.map(value => {
							value.infoDisabled = true
							return value
						})
					}
					this.getManagerTrusteeList = res.result || []
				} else {
					this.getManagerTrusteeList = []
					// this.$refs.uToast.show({
					// 	message: res.message,
					// 	type: 'error'
					// })
				}
			})
		},
		
		// 点击是否用印
		handleChangeSeal (val) {
			if (val == 0) {
				this.$set(this.basicForm,'noFormalContract','0') // 置空无正式合同
				if (this.getManagerTrusteeList && this.getManagerTrusteeList.length) {
					// dataSource3
					this.getManagerTrusteeList.forEach(value => {
						value.psnName = null
						value.psnMobile = null
						return value
					})
				}
				if (this.getManagerEntrustList && this.getManagerEntrustList.length) {
						// dataSource4
					this.getManagerEntrustList.forEach(value => {
						value.isSignSeal = '0'
						value.psnName = null
						value.psnMobile = null
						return value
					})
				}
				this.$set(this.basicForm, 'signSealWay', '')
			} else if (val == '1') {
				this.$set(this.basicForm,'noFormalContract','') // 置空无正式合同
			}
		},
		// 点击选择用印类型
		handleSignSealWay (val) {
			if (val == 'online') {
				if (this.getManagerEntrustList && this.getManagerEntrustList.length) {
					this.getManagerEntrustList.forEach(value => {
						value.isSignSeal = '0'
						value.psnName = null
						value.psnMobile = null
						return value
					})
				}
			} else {
				if (this.getManagerTrusteeList && this.getManagerTrusteeList.length) {
					this.getManagerTrusteeList.forEach(value => {
						value.psnName = null
						value.psnMobile = null
						return value
					})
				}
				if (this.getManagerEntrustList && this.getManagerEntrustList.length) {
					this.getManagerEntrustList.forEach(value => {
						value.isSignSeal = '0'
						value.psnName = null
						value.psnMobile = null
						return value
					})
				}
			}
		},
		
		// 获取子表数据
		getChildren(promiseUrl,key,id){
			var params = { mainId: id }
			promiseUrl(params).then(res => {
				if (res.success) {
					this[key]= res.result.records || res.result
				} else {
					this.$refs.uToast.show({
						message: res.message,
						type: 'error'
					})
				}
			})
		},
		
		onHtlxDetail (item) {
			this.getManagerEntrustList = []
			this.getManagerTrusteeList = []
			if (item == 1) {
				// 收款合同
				this.ManagerEntrustType = 'isFk' // 第一个值
				this.ManagerTrusteeType = 'isSk'
			} else {
				// 付款合同
				this.ManagerEntrustType = 'isSk' // 第一个值
				this.ManagerTrusteeType = 'isFk'
			}
			
		},
		
		handleChangeCategory(val) {
			if (val != '1') {
				this.$set(this.basicForm, 'provisionType', '');
				this.$set(this.basicForm, 'purchaseApplyId', '');
				this.$set(this.basicForm, 'calibrationId', '');
				this.$set(this.basicForm, 'invitationId', '');
			} 
		},
		
		handleChangeProvisionType(val) {
			if (val == '1') {
				this.$set(this.basicForm, 'purchaseApplyId', '');
				this.$set(this.basicForm, 'invitationId', '');
			} else if (val == '2') {
				this.$set(this.basicForm, 'calibrationId', '');
				this.$set(this.basicForm, 'invitationId', '');
			} else if (val == '3'){
				this.$set(this.basicForm, 'calibrationId', '');
				this.$set(this.basicForm, 'purchaseApplyId', '');
			} else {
				//清除采购申请单数据及校验
				this.$set(this.basicForm, 'purchaseApplyId', '');
				//清除招标采购申请单数据及校验
				this.$set(this.basicForm, 'invitationId', '');
				//清除定标结果确认单数据及校验
				this.$set(this.basicForm, 'calibrationId', '');
			}
		},
		
		// 选择服务期限
		onServiceChange (val) {
			this.$set(this.basicForm, 'fwqx', val[0] + ' 00:00:00')
			this.$set(this.basicForm, 'fwqxEnd', val[1] + ' 23:59:59')
		},
		
		// 获取收款合同详情
		onSkhtmcDetail (item) {
			this.$set(this.basicForm, 'jf', item.qddw)
			this.$set(this.basicForm, 'skhte', item.bchte)
			this.$set(this.basicForm, 'skhtedx', item.bchtedx)
		},
		
		// 选择业主单位
		onCustomerChange(id) {
			this.$set(this.basicForm, 'lxr', ''); // 联系人值为空
			this.$set(this.basicForm, 'lxfs', ''); // 联系方式值为空
			
			this.cust_lxr = 'erp_omc_customer_manager_contact,lxr,id,del_flag=0 and main_id=\'' + this.basicForm.yzdw + '\'';
		},
		
		// 选择联系人
		lxrChange (val) {
			var params = {id: val}
			erpOmcCustomerManagerContactId(params).then(res => {
				if (res.success) {
					this.$set(this.basicForm, 'lxfs', res.result.lxfs)
				} else {
					this.$refs.uToast.show({
						message: res.message,
						type: 'error'
					})
				}
			})
		},
		
		// 修改本次合同额大写和修改任务信息中的合同占比
		convertMoney2(item) {
			let money = Number(this.basicForm.bchte)
			this.$set(this.basicForm, 'bchtedx', convertCurrency(money))
			this.getManagerClassList.forEach((item, index) => {
				item.finalId = item.id
				// if (this.basicForm.bchte && item.htzb) {
				// 	// item.fphte = this.basicForm.bchte * item.htzb / 100
				// 	let amount = item.fphte / this.basicForm.bchte * 100
				// 	item.htzb = (Math.round((amount + Number.EPSILON) * 100) / 100) + '';
				// }
				if(this.basicForm.bchte>0){
					if(this.basicForm.distributionMethod==1){
						// 按比例：更改预计合同额，占比不变、对应的分配合同额实时变化
						// item.fphte = parseFloat(item.htzb*0.01*parseFloat(this.basicForm.bchte)).toFixed(2)
						let amount = this.basicForm.bchte * item.htzb / 100
						item.fphte = Math.round((amount + Number.EPSILON) * 100) / 100
					} else {
						// 按金额：更改预计合同额，分配合同额不变、对应的占比实时变化
						let rate = item.fphte / this.basicForm.bchte * 100
						item.htzb = Math.round((rate + Number.EPSILON) * 100) / 100;
						// item.htzb = parseFloat(parseFloat(item.fphte) / parseFloat(this.basicForm.bchte)*100).toFixed(2)
					}
				} else {
					if(this.basicForm.distributionMethod==1){
						// 按比例：更改预计合同额，占比不变、对应的分配合同额实时变化
						item.fphte = 0
					} else {
						// 按金额：更改预计合同额，分配合同额不变、对应的占比实时变化
						item.htzb = 0
					}
				}
				
			})
		},
		// 切换项目 任务信息  数据占比信息改变
		changeMoney(){
			if (this.basicForm.bchte&&this.getManagerClassList.length) {
				this.getManagerClassList.forEach((item) => {
					if(this.basicForm.distributionMethod==1){
						// 按比例：更改预计合同额，占比不变、对应的分配合同额实时变化
						// item.fphte = parseFloat(item.htzb*0.01*parseFloat(this.basicForm.bchte)).toFixed(2)
						let amount = this.basicForm.bchte * item.htzb / 100
						item.fphte = Math.round((amount + Number.EPSILON) * 100) / 100
					} else {
						// 按金额：更改预计合同额，分配合同额不变、对应的占比实时变化
						let rate = item.fphte / this.basicForm.bchte * 100
						item.htzb = Math.round((rate + Number.EPSILON) * 100) / 100;
						// item.htzb = parseFloat(parseFloat(item.fphte) / parseFloat(this.basicForm.bchte)*100).toFixed(2)
					}
				})
			}
		},
		// 监听修改本次合同额数据
		convertMoneyBlur2 (item) {
			let money = Number(this.basicForm.bchte)
			this.$set(this.basicForm, 'bchte', money.toFixed(2))
		},
		
		// 填写合同占比修改分配合同额
		onChangehtzb (index, value) {
			let amount = this.basicForm.bchte * this.getManagerClassList[index].htzb / 100
			var num = Math.round((amount + Number.EPSILON) * 100) / 100
			this.getManagerClassList[index].fphte = num + ''
		},
		
		// 填写分配合同额修改分配合同额
		onChangefphte (index, value) {
			let rate = this.getManagerClassList[index].fphte / this.basicForm.bchte * 100
			var num = Math.round((rate + Number.EPSILON) * 100) / 100
			this.getManagerClassList[index].htzb = num + ''
		},
		
		
		// 关闭弹窗
		closePopup () {
			this.showPopup = false
		},
		
		onPlainFormMoneyBlur () {
			if (this.plainForm.collectMoney) {
				if (this.plainForm.je === '') {
					return false
				}
				if (Number(this.plainForm.je) < Number(this.plainForm.collectMoney)) {
					this.plainForm.je = this.plainForm.collectMoney
				}
			}
		},
		// 弹窗点击确定
		onConfirmPopup () {
			if (!this.plainForm.kxmc) {
				uni.showToast({
					title: '请输入款项名称',
					icon: 'none'
				})
				return false
			}
			if (this.plainForm.je == '' || this.plainForm.je == null) {
				uni.showToast({
					title: '请输入金额',
					icon: 'none'
				})
				return false
			}
			if (!this.plainForm.kxrq) {
				uni.showToast({
					title: '请选择款项日期',
					icon: 'none'
				})
				return false
			}
			if (!this.plainForm.kxjdsm) {
				uni.showToast({
					title: '请输入节点说明',
					icon: 'none'
				})
				return false
			}
			this.showPopup = false
			if (this.clickPopup == 'edit') {
				this.getManagerPlanList[this.managerPlanIndex] = this.plainForm
			} else {
				this.plainForm.infoDisabled = false
				this.getManagerPlanList.push(this.plainForm)
			}
		},
		
		// 收付款计划编辑
		onManagerPlanEdit (item, index) {
			this.showPopup = true
			this.clickPopup = 'edit'
			this.managerPlanIndex = index
			this.plainForm = item
		},
		onManagerPlanAdd (item, index) {
			this.index = null
			this.basicFormC = {}
			this.showFormModalC = true
		},
		handleEditFormC([item, index]) {
		  this.basicFormC = { ...item }
		  this.index = index
		  this.showFormModalC = true
			this.$nextTick(() => {
				this.openFormModalC()
			})
		},
		handleRemoveFormC(item) {
		  this.getManagerPlanList = this.getManagerPlanList.filter((i) => i !== item)
		},
		closeFormModalC() {
		  this.$refs.dataFormC.reset()
		  this.basicFormC = {}
		  this.index = null
			this.showFormModalC = false
		},
		openFormModalC() {
		  this.$refs.dataFormC.basicForm = Object.assign({},this.basicFormC)
			this.$refs.dataFormC.formDataC = this.basicFormC.planTaskList || []
		},
		handleCopyFormC([item, index]) {
		  this.getManagerPlanList.push({
		    ...item,
		  })
		  this.$refs.uToast.show({
		  	message:'复制成功!'
		  })
		},
		addFormC() {
		  this.index = null
			this.basicFormC = {}
		  this.showFormModalC = true
		},
		/**
		 * 子表单新增点击确认
		 */
		handleFormSubmitC([data, index]) {
		  this.showFormModalC = false
		  if (typeof index === 'number') {
		    this.$set(this.getManagerPlanList, index, data)
		  } else {
		    this.getManagerPlanList.push(data)
		  }
		  // this.initBuyerInfo()
		},
		
		
		// 收付款计划删除
		onManagerPlanDelete (item, index) {
			let _this = this
			uni.showModal({
				title: '确定删除',
				content: '确定删除此信息？',
				success (res) {
						if (res.confirm) {
							_this.getManagerPlanList.splice(index, 1)
						} else if (res.cancel) {
							// 用户点击取消
						}
					}
				
			})
		},
		
		// 点击新增受托方弹窗
		onManagerEntrustAdd () {
			this.commissionedForm.khdaId = '' // 清空数据
			if (this.basicForm.signSealWay == 'online') {
				this.commissionedForm.isSignSeal = '0'
			}
			this.$set(this.commissionedForm, [this.ManagerEntrustType],'')
			this.clickManagerEntrustPopup = 'add'
			this.showCommissionedPopup = true
			
		},
		// 点击编辑受托方弹窗
		onManagerEntrustEdit (item, index) {
			this.commissionedForm.khdaId = item.khdaId
			this.commissionedForm[this.ManagerEntrustType] = item[this.ManagerEntrustType]
			this.commissionedForm = {...item}
			this.commissionedIndex = index
			this.clickManagerEntrustPopup = 'edit'
			this.showCommissionedPopup = true
		},
		// 删除受托方列表
		onManagerEntrustDelete (item, index) {
			let _this = this
			uni.showModal({
				title: '确定删除',
				content: '确定删除此信息？',
				success (res) {
						if (res.confirm) {
							_this.getManagerEntrustList.splice(index, 1)
						} else if (res.cancel) {
							// 用户点击取消
						}
					}
				
			})
		},
		// 关闭受托方信息
		closeCommissionedPopup () {
			this.showCommissionedPopup = false
		},
		// 確定受托方信息
		onConfirmCommissionedPopup () {
			if (!this.commissionedForm.khdaId) {
				this.showMessage('请选择关联往来单位')
				return false
			}
			if (this.commissionedForm[this.ManagerEntrustType] == '') {
				var message = this.basicForm.htlx == 1? '请选择是否为付款单位' :'请选择是否为收款单位'
				this.showMessage(message)
				return false
			}
			if (this.basicForm.signSealWay == 'online') {
				if (this.commissionedForm.isSignSeal === '' || this.commissionedForm.isSignSeal === null || this.commissionedForm.isSignSeal === undefined) {
					this.showMessage('请选择对方是否为电子签章')
					return false
				} else if (this.commissionedForm.isSignSeal == 1) {
					if (!this.commissionedForm.psnName) {
						this.showMessage('请输入人员姓名')
						return false
					}
					if (!this.commissionedForm.psnMobile) {
						this.showMessage('请输入联系方式')
						return false
					}
					let reg = new RegExp(/(^1\d{10}$|^(0\d{2,3}-?|\(0\d{2,3}\))?[1-9]\d{4,7}(-\d{1,8})?$)|(^\/$)/)
					if (!reg.test(this.commissionedForm.psnMobile)) {
						this.showMessage('请输入正确的联系方式')
						return false
					}
				}
			}
			
			this.confirmCommissionedId(this.commissionedForm.khdaId,this.commissionedForm )
			this.showCommissionedPopup = false
			
		},
		// 受托方详情
		confirmCommissionedId (id, commissionedForm){
			erpPurchaseSupplierId({id}).then(res => {
				if (res.success) {
					var idPar = parseInt(Math.random() * 1000000000000);
					var arr = {}
					var text = ''
					if (this.clickManagerEntrustPopup == 'edit') {
						arr = {
							id: idPar,
							khdaId: res.result.id,
							khdaId_dictText: res.result.enterpriseName,
							isSignSeal: commissionedForm.isSignSeal,
							psnMobile: commissionedForm.psnMobile,
							psnName: commissionedForm.psnName
							// isSk: this.commissionedForm[this.ManagerEntrustType],
							// isSk_dictText: this.commissionedForm[this.ManagerEntrustType] == 0? '否' : '是'
						}
						arr[this.ManagerEntrustType] = this.commissionedForm[this.ManagerEntrustType]
						text = this.ManagerEntrustType + '_dictText'
						arr[text] = this.commissionedForm[this.ManagerEntrustType] == 0? '否' : '是'
						this.getManagerEntrustList.splice(this.commissionedIndex, 1, arr)
					} else {
						arr = {
							id: idPar,
							khdaId: res.result.id,
							khdaId_dictText: res.result.enterpriseName,
							isSignSeal: commissionedForm.isSignSeal,
							psnMobile: commissionedForm.psnMobile,
							psnName: commissionedForm.psnName
						}
						arr[this.ManagerEntrustType] = this.commissionedForm[this.ManagerEntrustType]
						text = this.ManagerEntrustType + '_dictText'
						arr[text] = this.commissionedForm[this.ManagerEntrustType] == 0? '否' : '是'
						this.getManagerEntrustList.push(arr)
						
					}
				} else {
					this.$refs.uToast.show({
						message: res.message,
						type: 'error'
					})
				}
			})
		},
		
		// 点击新增委托方弹窗
		onManagerTrusteeAdd () {
			this.managerTrusteeForm.gsdaId = '' // 清空数据
			this.managerTrusteeForm.isFk = '' // 清空数据
			if (this.basicForm.signSealWay == 'online') {
				this.managerTrusteeForm.psnName = ''
				this.managerTrusteeForm.psnMobile = ''
			}
			this.$set(this.managerTrusteeForm,this.ManagerTrusteeType,'')
			this.clickManagerTrusteePopup = 'add'
			this.showManagerTrusteePopup = true
		},
		
		// 点击编辑委托方弹窗
		onManagerTrusteeEdit (item, index) {
			this.managerTrusteeForm.gsdaId = item.gsdaId
			this.managerTrusteeForm[this.ManagerTrusteeType] = item[this.ManagerTrusteeType]
			this.managerTrusteeForm = {...item}
			this.managerTrusteeIndex = index
			this.clickManagerTrusteePopup = 'edit'
			this.showManagerTrusteePopup = true
			
			
		},
		
		// 点击删除委托方弹窗
		onManagerTrusteeDelete (item, index) {
			let _this = this
			uni.showModal({
				title: '确定删除',
				content: '确定删除此信息？',
				success (res) {
						if (res.confirm) {
							_this.getManagerTrusteeList.splice(index, 1)
						} else if (res.cancel) {
							// 用户点击取消
						}
					}
				
			})
		},
		
		// 委托方确定按钮
		onConfirmManagerTrusteePopup () {
			if (!this.managerTrusteeForm.gsdaId) {
				this.showMessage('请选择公司')
				return false
			}
			if (this.managerTrusteeForm[this.ManagerTrusteeType] == '') {
				var message = this.basicForm.htlx == 1? '请选择是否为收款单位' :'请选择是否为付款单位'
				this.showMessage(message)
				return false
			}
			if (this.basicForm.signSealWay == 'online') {
				if (!this.managerTrusteeForm.psnName) {
					this.showMessage('请输入人员姓名')
					return false
				}
				if (!this.managerTrusteeForm.psnMobile) {
					this.showMessage('请输入联系方式')
					return false
				}
				let reg = new RegExp(/(^1\d{10}$|^(0\d{2,3}-?|\(0\d{2,3}\))?[1-9]\d{4,7}(-\d{1,8})?$)|(^\/$)/)
				if (!reg.test(this.managerTrusteeForm.psnMobile)) {
					this.showMessage('请输入正确的联系方式')
					return false
				}
			}
			this.getManagerTrusteeId(this.managerTrusteeForm.gsdaId, this.managerTrusteeForm)
			this.showManagerTrusteePopup = false
		},
		
		// 关闭委托方弹窗
		closeManagerTrusteePopup () {
			this.showManagerTrusteePopup = false
		},
		
		getManagerTrusteeId (id, managerTrusteeForm) {
			erpCompanyFilesId({id}).then(res => {
				if (res.success) {
					var idPar = parseInt(Math.random() * 1000000000000);
					if (this.clickManagerTrusteePopup == 'edit') {
						var arr = {
							id: idPar,
							gsdaId: res.result.id,
							gsdaId_dictText: res.result.fileName,
							psnMobile: managerTrusteeForm.psnMobile,
							psnName: managerTrusteeForm.psnName
							// isFk: this.managerTrusteeForm[this.ManagerTrusteeType],
							// isFk_dictText: this.managerTrusteeForm[this.ManagerTrusteeType] == 0? '否' : '是'
						}
						arr[this.ManagerTrusteeType] = this.managerTrusteeForm[this.ManagerTrusteeType]
						var text = this.ManagerTrusteeType + '_dictText'
						arr[text] = this.managerTrusteeForm[this.ManagerTrusteeType] == 0? '否' : '是'
						this.getManagerTrusteeList.splice(this.managerTrusteeIndex, 1, arr)
					} else {
						var arr = {
							id: idPar,
							gsdaId: res.result.id,
							gsdaId_dictText: res.result.fileName,
							psnMobile: managerTrusteeForm.psnMobile,
							psnName: managerTrusteeForm.psnName
						}
						arr[this.ManagerTrusteeType] = this.managerTrusteeForm[this.ManagerTrusteeType]
						var text = this.ManagerTrusteeType + '_dictText'
						arr[text] = this.managerTrusteeForm[this.ManagerTrusteeType] == 0? '否' : '是'
						this.getManagerTrusteeList.push(arr)
						
					}
					
				} else {
					this.$refs.uToast.show({
						message: res.message,
						type: 'error'
					})
				}
			})
		},
		
		
		showMessage (item) {
			uni.showToast({
				title: item,
				icon: 'none'
			})
		},
		
		// 查询流程流转信息 -- 获取下一节点信息
		getProcessTaskTrans(taskId){
			getProcessTaskTransInfo({ taskId }).then(res => {
				if(res.success){
					this.resultObj = res.result
				} else {
					this.$refs.uToast.show({
						message: res.message,
						type: 'error'
					})
				}
			}).catch(err => {
				console.log(err);
			})
		},
		// 点击提交
		onSubmit () {
			const hasNullCutContractAmount = this.getManagerClassList.some(item => item.cutContractAmount === '')
			if(hasNullCutContractAmount) return  this.$refs.uToast.show({message: '请填写切割合同额' }) 
			var _this = this
			// 合同名称
			if(!this.basicForm.htmc) {
				this.showMessage('请输入合同名称')
				return false
			}
			// if (this.basicForm.isCategoryType == 1 && !this.basicForm.provisionType) {
			// 	uni.showToast({
			// 		title: '请选择采购类型',
			// 		icon: 'none'
			// 	})
			// 	return false
			// }
			// if (this.basicForm.isCategoryType ==1 && this.basicForm.provisionType) {
			// 	if (this.basicForm.provisionType == 1 && !this.basicForm.calibrationId) {
			// 		uni.showToast({
			// 			title: '请选择关联单据',
			// 			icon: 'none'
			// 		})
			// 		return false
			// 	}
			// 	if (this.basicForm.provisionType == 2 && !this.basicForm.purchaseApplyId) {
			// 		uni.showToast({
			// 			title: '请选择关联单据',
			// 			icon: 'none'
			// 		})
			// 		return false
			// 	}
			// 	if (this.basicForm.provisionType == 3 && !this.basicForm.invitationId) {
			// 		uni.showToast({
			// 			title: '请选择关联单据',
			// 			icon: 'none'
			// 		})
			// 		return false
			// 	}
			// }
			// 业绩归属年度
			if(!this.basicForm.yjgsnd) {
				this.showMessage('请选择业绩归属年度')
				return false
			}
			// 业主单位
			if(!this.basicForm.yzdw) {
				this.showMessage('请选择业主单位')
				return false
			}
			
			// 联签订日期
			if(!this.basicForm.qdrq) {
				this.showMessage('请选择签订日期')
				return false
			}
			// // 保证金
			// if(!String(this.basicForm.bail) && this.basicForm.htlx == 1) {
			// 	this.showMessage('请输入履约保证金')
			// 	return false
			// }
			// 保证金
			// if(!String(this.basicForm.distributionMethod) && this.basicForm.htlx == 1) {
			// 	this.showMessage('请输入分配方式')
			// 	return false
			// }
			// 印章类型和用印份数
			if (this.basicForm.sfyz && this.basicForm.sfyz ==1) {
				if(!this.basicForm.yzlx) {
					this.showMessage('请选择印章类型')
					return false
				}
				if(!this.basicForm.yyfs) {
					this.showMessage('请输入用印份数')
					return false
				}
				if(!this.basicForm.signSealWay) {
					this.showMessage('请选择用印类型')
					return false
				}
			}
			if (this.basicForm.sfyz == '0') {
				if(this.basicForm.noFormalContract === undefined || this.basicForm.noFormalContract === null || this.basicForm.noFormalContract === '') {
					this.showMessage('请选择无正式合同')
					return false
				}
			}
			if(this.basicForm.htlx !='1' && this.basicForm.glskht == 1){
				if(!this.basicForm.skhtmc) {
					this.showMessage('请选择收款合同名称')
					return false
				}
			}
			// 是否存档
			if (this.basicForm.sfcd === '' || this.basicForm.sfcd === null || this.basicForm.sfcd === undefined) {
				this.showMessage('请选择是否存档')
				return false
			}
			// 服务期限
			if (this.basicForm.fwqx === '' || this.basicForm.fwqx === null || this.basicForm.fwqx === undefined) {
				this.showMessage('请选择服务期限')
				return false
			}
			if (this.basicForm.sfcd == '1' && (this.basicForm.cdfs === '' || this.basicForm.cdfs === null)) {
				this.showMessage('请输入存档份数')
				return false
			}
			// if (this.basicForm.businessPerformance === '' || this.basicForm.businessPerformance === null || this.basicForm.businessPerformance === undefined) {
			// 	this.showMessage('请输入经营绩效')
			// 	return false
			// }
			
			// 后端接口要数值类型
			if (this.basicForm.cdfs === '') {
				this.basicForm.cdfs = null
			}
			let planSum = 0;
			this.getManagerPlanList.forEach(data=>{
				planSum += parseFloat(data.je);
			});
			// if(parseFloat(this.basicForm.bchte).toFixed(2)!=parseFloat(planSum).toFixed(2)){
			// 	uni.showToast({
			// 		title: '计划总金额与合同金额不对等!',
			// 		icon: 'none'
			// 	})
			// 	return false;
			// }
			
			// if (this.basicForm.htlx === 1 || this.basicForm.htlx === '1') {
			// 	if(this.basicForm.distributionMethod==1){
			// 		let rate = 0
			// 		this.getManagerClassList.forEach(val => {
			// 			// rate = Decimal(total).add(Decimal(val.htzb)).toNumber() 
			// 			rate += parseFloat(val.htzb)
			// 		})
			// 		if (rate != 100) {
			// 			this.$refs.uToast.show({
			// 				message:'合同占比相加不等于100%，请重新填写!'
			// 			})
			// 			return false;
			// 		}
			// 	} else {
			// 		let total = 0
			// 		this.getManagerClassList.forEach((val) => {
			// 		  // total = Decimal(total).add(Decimal(val.fphte)).toNumber() 
			// 			total += parseFloat(val.fphte)
			// 		})
			// 		// if (total.toFixed(2) != Number(this.basicForm.bchte).toFixed(2)) {
			// 		if (total.toFixed(2) != parseFloat(this.basicForm.bchte).toFixed(2)) {
			// 			this.$refs.uToast.show({
			// 				message:'所有分配金额总计和本次合同额不相等，请重新填写!'
			// 			})
			// 		  return false
			// 		}
			// 	}
			// }
			// if (this.basicForm.htlx == '1') {
			// 	// 这里判断需分配款项信息中的数据是否达到100%，如果达到则提交，否则提示需分配款项信息中的数据未达到100%
			// 	if (!this.handleJudgePayment()) {
			// 		return
			// 	}
			// }
			// if (this.basicForm.htlx == '1') {
			// 	if (this.getManagerPlanList.length === 0) {
			// 		// this.confirmLoading = false
			// 		// this.$emit('unButtonDisable');
			// 		uni.showToast({
			// 			title: '请填写收付款计划',
			// 			icon: 'none'
			// 		})
			// 		return;
			// 	}
			// }
			// 判断收付款计划中应收状态为未生成时，需要判断款项是否绑定了任务
			// if (this.basicForm.htlx == '1') {
			// 	let isBindTask = false;
			// 	for (let i = 0; i < this.getManagerPlanList.length; i++) {
			// 		if (this.getManagerPlanList[i].collectMoneyStatus != '已生成') {
			// 			if (!this.getManagerPlanList[i].planTaskList || !this.getManagerPlanList[i].planTaskList.length) {
			// 				isBindTask = true;
			// 				break;
			// 			}
			// 		}
			// 	}
			// 	if (isBindTask) {
			// 		uni.showToast({
			// 			title: '收付款计划需绑定“款项关联任务”',
			// 			icon: 'none'
			// 		})
			// 		return;
			// 	}
			// }
			
			if(this.basicForm.htlx=='1'){
				// 受托方(合同乙方)信息校验
				if(!!this.getManagerTrusteeList&&this.getManagerTrusteeList.length==0){
					this.showMessage("请填写受托方信息!")
					return false;
				}else{
					let hasSkList = this.getManagerTrusteeList.filter(item=>item.isSk=='1');
					// if(hasSkList.length!=1){
					// 	this.showMessage("受托方有且仅有一个是收款单位!")
					// 	return false;
					// }
					// 判断当选择是否用印为是且用印类型是电子签章的时候判断是否填写了盖章人信息和联系方式信息
					let psnName = this.getManagerTrusteeList.filter(item => !item.psnName);
					let psnMobile = this.getManagerTrusteeList.filter(item => !item.psnMobile);
					if (this.basicForm.sfyz && this.basicForm.sfyz == 1 && this.basicForm.signSealWay == 'online') {
						// 当主表选择了电子签章
						if (psnName.length || psnMobile.length) {
							this.showMessage('请填写受托方联系人和联系方式!')
						return false;
						}
					}
				}
				// 委托方(合同甲方)信息
				if(!!this.getManagerEntrustList&&this.getManagerEntrustList.length==0){
					this.showMessage("请填写委托方信息!")
					return false;
				}else{
				let hasFkList = this.getManagerEntrustList.filter(item=>item.isFk=='1');
					// 	if(hasFkList.length!=1){
					// 	this.showMessage("委托方有且仅有一个是付款单位!")
					// 	return false;
					// }
					// if (hasFkList.length <= 0) {
					//   this.$refs.uToast.show({
					// 		message:'委托方必须有一个是付款单位!'
					// 	})
					//   return false
					// }
					// 判断当选择是否用印为是且用印类型是电子签章的时候判断是否填写了盖章人信息和联系方式信息
					// let psnName = this.getManagerEntrustList.filter(item => item.psnName);
					// let psnMobile = this.getManagerEntrustList.filter(item => item.psnMobile);
					if (this.basicForm.sfyz && this.basicForm.sfyz == 1 && this.basicForm.signSealWay == 'online') {
						// 当主表选择了电子签章
						for (var i = 0; i < this.getManagerEntrustList.length; i++) {
							if (this.getManagerEntrustList[i].isSignSeal && this.getManagerEntrustList[i].isSignSeal == 1) {
								if (!this.getManagerEntrustList[i].psnName || !this.getManagerEntrustList[i].psnMobile) {
									this.showMessage('请填写委托方联系人和联系方式!')
									return
								}
							}
						}
					}
				}
				// return true;
			}else{
				// 付款合同 getManagerTrusteeList 为付款
				// 受托方(合同乙方)信息校验
				if(!!this.getManagerEntrustList&&this.getManagerEntrustList.length==0){
					this.showMessage("请填写受托方信息!")
					return false;
				}else{
					let hasSkList = this.getManagerEntrustList.filter(item=>item.isSk=='1');
					// if(hasSkList.length!=1){
					// 	this.showMessage("受托方有且仅有一个是收款单位!")
					// 	return false;
					// }
					
					// 判断当选择是否用印为是且用印类型是电子签章的时候判断是否填写了盖章人信息和联系方式信息
					// let psnName = this.getManagerEntrustList.filter(item => item.psnName);
					// let psnMobile = this.getManagerEntrustList.filter(item => item.psnMobile);
					if (this.basicForm.sfyz && this.basicForm.sfyz == 1 && this.basicForm.signSealWay == 'online') {
						// 当主表选择了电子签章
						for (var j = 0; j < this.getManagerEntrustList.length; j++) {
							if (this.getManagerEntrustList[j].isSignSeal && this.getManagerEntrustList[j].isSignSeal == 1) {
								if (!this.getManagerEntrustList[j].psnName || !this.getManagerEntrustList[j].psnMobile) {
									this.showMessage('请填写受托方联系人和联系方式!')
									return
								}
							}
						}
					}
				}
				// 委托方(合同甲方)信息校验
				if(!!this.getManagerTrusteeList&&this.getManagerTrusteeList.length==0){
					this.showMessage("请填写委托方信息!")
					return false;
				}else{
					let hasFkList = this.getManagerTrusteeList.filter(item=>item.isFk=='1');
					// if(hasFkList.length!=1){
					// 	this.showMessage("委托方有且仅有一个是付款单位!")
					// 	return false;
					// }
					// 判断当选择是否用印为是且用印类型是电子签章的时候判断是否填写了盖章人信息和联系方式信息
					let psnName = this.getManagerTrusteeList.filter(item => !item.psnName);
					let psnMobile = this.getManagerTrusteeList.filter(item => !item.psnMobile);
					if (this.basicForm.sfyz && this.basicForm.sfyz == 1 && this.basicForm.signSealWay == 'online') {
						// 当主表选择了电子签章
						if (psnName.length || psnMobile.length) {
							this.showMessage('请填写委托方联系人和联系方式!')
						return false;
						}
					}
				}
				// return true;
			}
			
			let model = {};
			Object.assign(model, this.basicForm)
			// 收付款计划
			model.planList = this.getManagerPlanList; // 
			model.planList.map((value, index) => {
				value.sortOrder = index
				return value
			})
			model.trusteeList = this.getManagerTrusteeList; // 委托方信息
			model.entrustList = this.getManagerEntrustList; // 受托方信息
			// 任务信息
			if (this.basicForm.htlx == 1) {
				model.classList = this.getManagerClassList;
			}
			// 
			
			erpOmcContractManagerEdit (model).then(res => {
				if (res.success) {
					// this.getManagerClassList = res.result || []
					this.$refs.uToast.show({
						message: '提交成功',
						type: 'success',
						complete () {
							_this.onAudit()
						}
					})
					this.isSubmit = true
				} else {
					this.$refs.uToast.show({
						message: res.message,
						type: 'error'
					})
				}
			})
		},
		
		// 判断需分配款项信息中的数据是否达到100%，如果达到则提交，否则提示需分配款项信息中的数据未达到100%
		handleJudgePayment() {
			var isTrue = true // true为通过，false为不通过
			// var _this = this
			var text = ''
			if (this.getManagerPlanList && this.getManagerPlanList.length > 0) {
				this.getManagerPlanList.forEach((item, index) => {
					if (item.collectMoneyStatus != '已生成') {
						if (item && item.planTaskList && item.planTaskList.length > 0) {
							// 判断item1中的 paymentRate之和是否等于100%
							const listTotal = item.planTaskList.reduce((total, item1) => {
								const paymentRate = Number(item1.paymentRate) || 0;
								const decimalContractRate = new Decimal(paymentRate);
								return total.plus(decimalContractRate);
							}, new Decimal(0)).toNumber(); // 解决浮点数导致两者不相等
							if (listTotal != 100) {
								text = '收付款计划中，款项绑定的任务，款项分配占比没有达到100%！'
								isTrue = false
							}
						} else {
							text = '收付款计划中、款项未绑定任务、需绑定任务！'
							isTrue = false // 没有任务时，不允许通过
						}
					}
				})
			}
			if (!isTrue) {
				this.showMessage(text)
			}
			return isTrue
		},
		
		onAudit() {
			if (!this.isSubmit) {
				uni.showToast({
					title: '请完善表单后审核',
					icon: 'none'
				})
				return false
			}
			var that = this
			uni.navigateTo({
				url: '/pages/synergy/ErpOmcContractApplicationList'+`?item=${encodeURIComponent(JSON.stringify(this.model).replace(/%/g, '%25'))}`,
				events: {
					// 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
					// acceptDataFromOpenedPage: function(data) {
					// }
				},
				success: function(data) {
					// 通过eventChannel向被打开页面传送数据
					var params = {
						nodeObj: encodeURIComponent(JSON.stringify(that.nodeObj).replace(/%/g, '%25')),
						tabvalue: that.tabvalue
					}
					data.eventChannel.emit('sendMessage', params)
				},
				fail: function(err) {
					this.$refs.uToast.show({
						message: '请联系管理员配置',
						type: 'error'
					})
				}
			})
		}
		
	}
};
</script>

<style lang="scss" scoped>
@import url("@/assets/inputStyle.scss");
// 评测信息
.info-title{
	font-size: 14px;
	font-family: PingFangSC-Regular, PingFang SC;
	font-weight: 400;
	color: #171717;
	line-height: 20px;
	padding-bottom: 16rpx;
}

// 评测结果
.result-style{
	font-size: 12px;
	font-family: PingFangSC-Regular, PingFang SC;
	font-weight: 400;
	color: #B2B2B2;
}

.inforamtion{
	margin-top: 10rpx;
	padding: 10rpx;
	border-radius: 15rpx;
	box-shadow: 0px 4px 20px 0px rgba(0,0,0,0.1);
}
</style>